//
//  BaseViewController.swift
//  SinaWeibo
//
//  Created by paycloud110 on 16/6/2.
//  Copyright © 2016年 paycloud110. All rights reserved.
//

import UIKit

class BaseViewController: UIViewController {
    
    var loginIn: Bool = false
    var vistorView: VistorView?
    
    override func loadView() {
        super.loadView()
        
        loginIn ? super.loadView():setUpViewController()
    }
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    private func setUpViewController() -> Void {
        
        vistorView = VistorView.vistorView()
        view = vistorView
        
        vistorView?.zhuCeButton.addTarget(self, action: Selector("registerClick"), forControlEvents: .TouchUpInside)
        vistorView?.loginButton.addTarget(self, action: Selector("loginClick"), forControlEvents: .TouchUpInside)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: Selector("registerClick"))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: Selector("loginClick"))
    }
    @objc private func registerClick() {
        
        JWNLog("register")
    }
    @objc private func loginClick() {
        
        JWNLog("login")
        let storyBoard = UIStoryboard(name: "OAuthViewController", bundle: nil)
        let OAuthVC = storyBoard.instantiateInitialViewController()!
        presentViewController(OAuthVC, animated: true, completion: nil)
    }
}
